package com.pn.controller;

import com.pn.entity.Brand;
import com.pn.entity.Supply;
import com.pn.service.BrandService;
import com.pn.service.SupplyService;
import com.pn.utils.PageBean;
import com.pn.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("brand")
public class BrandController {

    @Autowired
    private BrandService brandService;

    //显示品牌信息
    @GetMapping("/brand-page-list")
    public Result<PageBean<Brand>> brandPageList(Brand brand){
        PageBean pageBean = brandService.brandPageList(brand);
        return Result.ok(pageBean);
    }

    //修改品牌
    @PutMapping("/brand-update")
    public Result brandUpdate(@RequestBody Brand brand){
        return brandService.brandUpdate(brand);
    }


    //添加品牌
    @PostMapping("/brand-add")
    public Result brandAdd(@RequestBody Brand brand){
        return brandService.brandAdd(brand);
    }

    //删除品牌
    @DeleteMapping("/brand-delete/{brandId}")
    public Result brandDelete(@PathVariable Integer brandId){
        return brandService.brandDelete(brandId);
    }

}
